<template>
	<view>
		<!-- 导航栏 -->
		<cu-custom bgColor="bg-white" :isBack="true">
			<block slot="content">联系我们</block>
		</cu-custom>
		<view class="content">
			<view class="newList mt10">
				<scroll-view scroll-y="true" class="scroll-Y"  @scrolltolower="scrollToLower" :style="scrollH">
				<view>
					<view class="msg li" v-for="(item,index) in 2" :key='index'>
						<view class="con">
							标题
						</view>
						<view class="error">
							图片
						</view>
					</view>
				</view>
				</scroll-view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:0,
				hasMore:true,
				list:[]
			}
		},
		computed: {
			scrollH:function(){
				let sys = uni.getSystemInfoSync();
				let winHeight = sys.windowHeight;
				return 'height:' + (winHeight - 10) + 'px;'
			}
        },
		methods: {
			getList(){
				if(this.hasMore){
					this.$http
						.get('system_list', {page:this.page})
						.then((response) => {
							let _list = response.data.data
							let newlist = this.list.concat(_list);
							this.list = newlist
							this.page ++
							
							if(_list.length == 0)
								this.hasMore = false
								
								console.log(this.list)
						})
						.catch((response) => {
							
						})
				}
			},
			scrollToLower(){
				this.getList()
			}
		},
		onLoad(){
			this.getList()
		}
	}
</script>

<style>
	.mt10{
		padding-top: 10px;
	}
	.empty{
		padding: 20px;
		text-align: center;
		color: #CCC;
	}
	.newList{
		
	}
	.newList .tc{
		text-align:center;
	}
	.newList .li{
		margin-bottom:10px;
		overflow:hidden;
	}
	.newList .time{
		background: #AAA;
		color: #FFF;
		border-radius: 6px;
		margin-bottom: 10px;
		display: inline;
		padding: 3px 10px;
	}
	.msg{
		margin:0 10px;
		background:#FFF;
		border-radius:5px;
		padding:10px;
		line-height:20px;
	}
	.msg .con{
		color:#666;
		margin-bottom:10px;
	}
	.msg .error{
		border-top:1px solid #CCC;
		color:#f0415f;
		line-height:25px;
	}
</style>
